package com.oppo.skywalking.entity;

import com.google.common.collect.Lists;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

/**
 * @author steve
 * @since 2022-11-17 0:14
 */

@Slf4j
@Data
public class Person implements Serializable {

    /** 用户名 */
    private String username;

    /** 年龄 */
    private Integer age;

    /** 员工集合 */
    private List<Employee> employees;

    public static void main(String[] args) {
        Person person = new Person();
        person.setUsername("steve");
        person.setAge(20);
        Employee employee = new Employee();
        employee.setEmpId(1L);
        employee.setName("张三");
        employee.setGender((byte) 1);
        employee.setTitle("猫和老鼠");
        employee.setBirthday(new Date());
        employee.setDepId(null);

        Employee employee2 = new Employee();
        employee2.setEmpId(2L);
        employee2.setName("Jerry");
        employee2.setGender((byte) 2);
        employee2.setTitle("老鼠");
        employee2.setBirthday(new Date());
        employee2.setDepId("英国");

        person.setEmployees(Lists.newArrayList(employee, employee2));

        log.info("person:{}", person);

    }

    @Override
    public String toString() {
        return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
        // return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
    }
}
